# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DNS.V1.Model.ResponsePolicyRule do
  @moduledoc """
  A Response Policy Rule is a selector that applies its behavior to queries that match the selector. Selectors are DNS names, which may be wildcards or exact matches. Each DNS query subject to a Response Policy matches at most one ResponsePolicyRule, as identified by the dns_name field with the longest matching suffix.

  ## Attributes

  *   `behavior` (*type:* `String.t`, *default:* `nil`) - Answer this query with a behavior rather than DNS data.
  *   `dnsName` (*type:* `String.t`, *default:* `nil`) - The DNS name (wildcard or exact) to apply this rule to. Must be unique within the Response Policy Rule.
  *   `kind` (*type:* `String.t`, *default:* `dns#responsePolicyRule`) - 
  *   `localData` (*type:* `GoogleApi.DNS.V1.Model.ResponsePolicyRuleLocalData.t`, *default:* `nil`) - Answer this query directly with DNS data. These ResourceRecordSets override any other DNS behavior for the matched name; in particular they override private zones, the public internet, and GCP internal DNS. No SOA nor NS types are allowed.
  *   `ruleName` (*type:* `String.t`, *default:* `nil`) - An identifier for this rule. Must be unique with the ResponsePolicy.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :behavior => String.t() | nil,
          :dnsName => String.t() | nil,
          :kind => String.t() | nil,
          :localData => GoogleApi.DNS.V1.Model.ResponsePolicyRuleLocalData.t() | nil,
          :ruleName => String.t() | nil
        }

  field(:behavior)
  field(:dnsName)
  field(:kind)
  field(:localData, as: GoogleApi.DNS.V1.Model.ResponsePolicyRuleLocalData)
  field(:ruleName)
end

defimpl Poison.Decoder, for: GoogleApi.DNS.V1.Model.ResponsePolicyRule do
  def decode(value, options) do
    GoogleApi.DNS.V1.Model.ResponsePolicyRule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DNS.V1.Model.ResponsePolicyRule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
